package entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="Trajet")
public class Trajet implements Prestation {
	private long id;
	private Date dateDepart;
	private Date dateArrivee;
	private Lieu lieuDepart;
	private Lieu lieuArrivee;
	private ModeTransport modeTransport;
	private double tarif;

	public String toString() {
		return "[" 
			+ "Départ de " 
			+ lieuDepart 
			+ " à " 
			+ dateDepart 
			+ ", "
			+ "Arrivée à " 
			+ lieuArrivee 
			+ " à " 
			+ dateArrivee 
			+ ", " 
			+ modeTransport 
			+ ", " 
			+ tarif 
			+ "]";
	}

	public Trajet() {
		super();
	}
	public Trajet(Date dateDepart, Date dateArrivee, Lieu lieuArrivee,
			Lieu lieuDepart, ModeTransport modeTransport, double tarif) {
		super();
		this.dateArrivee = dateArrivee;
		this.dateDepart = dateDepart;
		this.lieuArrivee = lieuArrivee;
		this.lieuDepart = lieuDepart;
		this.modeTransport = modeTransport;
		this.tarif = tarif;
	}
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public Date getDateDepart() {
		return dateDepart;
	}
	public void setDateDepart(Date dateDepart) {
		this.dateDepart = dateDepart;
	}
	public Date getDateArrivee() {
		return dateArrivee;
	}
	public void setDateArrivee(Date dateArrivee) {
		this.dateArrivee = dateArrivee;
	}
	@OneToOne()
	@JoinColumn(name = "lieuDepart")
	public Lieu getLieuDepart() {
		return lieuDepart;
	}
	public void setLieuDepart(Lieu lieuDepart) {
		this.lieuDepart = lieuDepart;
	}
	@OneToOne()
	@JoinColumn(name = "lieuArrivee")
	public Lieu getLieuArrivee() {
		return lieuArrivee;
	}
	public void setLieuArrivee(Lieu lieuArrivee) {
		this.lieuArrivee = lieuArrivee;
	}
	@OneToOne()
	@JoinColumn(name = "modeTransport")
	public ModeTransport getModeTransport() {
		return modeTransport;
	}
	public void setModeTransport(ModeTransport modeTransport) {
		this.modeTransport = modeTransport;
	}
	public double getTarif() {
		return tarif;
	}
	public void setTarif(double tarif) {
		this.tarif = tarif;
	}

}
